package com.cloud.mybatis.config;

import cn.hutool.core.codec.Base64;
import cn.hutool.crypto.symmetric.SymmetricAlgorithm;
import cn.hutool.crypto.symmetric.SymmetricCrypto;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Data
@Configuration
@ConfigurationProperties(prefix = "sm")
public class SmConfig {
    private String key;


    @Bean
    public SymmetricCrypto  sm4(){
      return   new SymmetricCrypto(SymmetricAlgorithm.AES, Base64.decode(key));

    }
}
